package com.ruoyi.service.impl;

import java.util.List;

import com.ruoyi.domain.Student;
import com.ruoyi.domain.StudentEvaluation;
import com.ruoyi.mapper.StudentEvaluationMapper;
import com.ruoyi.service.IStudentEvaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ruoyi
 * @date 2024-04-22
 */
@Service
public class StudentEvaluationServiceImpl implements IStudentEvaluationService {
    @Autowired
    private StudentEvaluationMapper studentEvaluationMapper;

    /**
     * 查询【请填写功能名称】
     *
     * @param teachId 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public StudentEvaluation selectStudentEvaluationByTeachId(Long teachId) {
        return studentEvaluationMapper.selectStudentEvaluationByTeachId(teachId);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param studentEvaluation 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<StudentEvaluation> selectStudentEvaluationList(StudentEvaluation studentEvaluation) {
        return studentEvaluationMapper.selectStudentEvaluationList(studentEvaluation);
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param studentEvaluation 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertStudentEvaluation(StudentEvaluation studentEvaluation) {
        return studentEvaluationMapper.insertStudentEvaluation(studentEvaluation);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param studentEvaluation 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateStudentEvaluation(StudentEvaluation studentEvaluation) {
        return studentEvaluationMapper.updateStudentEvaluation(studentEvaluation);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param teachIds 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteStudentEvaluationByTeachIds(Long[] teachIds) {
        return studentEvaluationMapper.deleteStudentEvaluationByTeachIds(teachIds);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param teachId 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteStudentEvaluationByTeachId(Long teachId) {
        return studentEvaluationMapper.deleteStudentEvaluationByTeachId(teachId);
    }

    @Override
    public List<Student> getAllStudentRate(Long studentId, String studentName, String major) {
        String studentIdStr = null;
        if (studentId != null) {
            studentIdStr = "%" + studentId + "%";
        }
        if (studentName != null) {
            studentName = "%" + studentName + "%";
        }
        if (major != null) {
            major = "%" + major + "%";
        }
        return studentEvaluationMapper.getAllStudentRate(studentIdStr, studentName, major);
    }

    @Override
    public StudentEvaluation getStudentRate(Long studentId, Long teachId) {
        return studentEvaluationMapper.getStudentRate(studentId, teachId);
    }
}
